package com.zyh.service.impl;

import com.zyh.entity.Book;
import com.zyh.entity.BorrowBook;
import com.zyh.entity.BorrowBookVo;
import com.zyh.mapper.Bookmapper;
import com.zyh.mapper.Usermapper;
import com.zyh.service.BookService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;

@Service
public class BookServiceImpl implements BookService {
    @Autowired
    Bookmapper bookmapper;
    @Autowired
    Usermapper usermapper;

    @Override
    public List<Book> getAllBook(Book book) {
        return bookmapper.getAllBook(book);
    }

    @Override
    public Integer getBookCount(Book book) {
        return bookmapper.getBookCount(book);
    }

    @Override
    public BorrowBookVo selectBook(Integer id) {
        return bookmapper.selectBook(id);
    }

    @Override
    public Integer updateBookWithId(Book book) {
        return bookmapper.updateBookWithId(book);
    }

    @Override
    public Integer DeleteBookByids(Integer[] id) {
        return usermapper.DeleteBookByids(id);
    }

    @Override
    public Integer addBook(Book book) {
        return bookmapper.addBook(book);
    }

    @Override
    public Integer BorrowBookWithId(Book book) {
        return bookmapper.BorrowBookWithId(book);
    }

    @Override
    public List<BorrowBookVo> getBorrowBook(BorrowBookVo borrowbookVo) {
        return bookmapper.getBorrowBook(borrowbookVo);
    }

    @Override
    public Integer getBorrowCount(BorrowBookVo borrowBookVo) {
        return bookmapper.getBorrowCount(borrowBookVo);
    }

    @Override
    public Integer BorrowBookWithIds(Integer[] id) {
        return  bookmapper.BorrowBookWithIds(id);
    }

    @Override
    public Integer SendBookWithId(BorrowBookVo borrowBookVo) {
        return bookmapper.SendBookWithId(borrowBookVo);
    }

//    @Override
//    public List<BorrowBookVo> selectbyuserid(HashMap p) {
//        return bookmapper.selectbyuserid(p);
//   }

    @Override
    public List<BorrowBookVo> selectbyuserid(BorrowBookVo borrowBookVo) {
        return bookmapper.selectbyuserid(borrowBookVo);
    }
    @Override
    public Integer addBorrow(List<BorrowBookVo> borrowBookVos) {
        return bookmapper.addBorrow(borrowBookVos);
    }

    @Override
    public Integer sendBorrow(List<BorrowBookVo> borrowBookVos) {
        return bookmapper.sendBorrow(borrowBookVos);
    }

    @Override
    public List<BorrowBookVo> getBorrowHistory(BorrowBookVo borrowBookVo) {
        return bookmapper.getBorrowHistory(borrowBookVo);
    }

    @Override
    public Integer getBorrowBookCount(BorrowBookVo borrowBookVo) {
        return bookmapper.getBorrowBookCount(borrowBookVo);
    }

}
